package makex

import (
	"fmt"
	"time"

	"std/abcx"

	"github.com/gookit/color"
)

type Var struct {
}

func (p Var) basic() {
	var ok *string //nil
	color.Yellowln(ok, ok == nil)
	//*ok = "asas" // panic
	color.Yellowln(ok)
}

func (p Var) arr() {
	var ok []int //nil
	fmt.Println(ok, ok == nil, len(ok))
	ok = append(ok, 1, 2)
	fmt.Println(ok)
}

func (p Var) chanx() {
	var ok chan int //nil
	color.Yellowln(ok, ok == nil, len(ok))
	go func() {
		color.Yellowln("chan", ok, <-ok)
	}()
	time.Sleep(1 * time.Second)
}

func (p Var) mapx() {
	var ok map[int]any //nil
	color.Greenln(ok, ok == nil, len(ok))
	//ok[1] = "as" // panic
	color.Greenln(ok)
}
func (p Var) structx() {
	var ok abcx.Person
	color.Blueln(ok)
}
